{include file='../../../PublicView/include.html'}
<script src="/assets/shopadmin/shopmodule/gifts.js"></script>
<link href="http://g.tbcdn.cn/kissy/k/1.3.2/??calendar/assets/shopadmin/dpl-min.css" rel="stylesheet">
<div class="taeapp admin-table" cellpadding="0" cellspacing="0" border="0">
        <div class="taeapp admin-table-side  tips tips-small tips-notice tips-no-icon">
            <!--菜单部分-->
            <div class="taeapp admin-nav">
			{include file='../../../PublicView/shopleft.html'}
			</div>
            <!--菜单部分-->
        </div>
        <div class="taeapp admin-table-main">
            <!--内容部分-->
				<ul class="breadcrumb">
					<li><a href="/">互动到店</a> <span class="divider">/</span></li>
					<li>抽奖管理 <span class="divider">/</span></li>
					<li class="active">{$title}</li>
				</ul>
		
			<!--内容部分-->
			{include file='../../../PublicView/showmessage.html'}
			<div class="row">
			  <form class="form-panel form-horizontal" method="post" action="/?a=manual&c=wins&m=shopadmin">
				<div class="panel-title">
				  请选择订单范围：
				</div>
				<div class="panel-content">
				<div class="control-group ">
					<label class="control-label">订单范围：</label>
					<div class="controls control-row-auto span14 span-width">
						<div class="well well-small">
							<div class="row control-row1">
								<span class="auxiliary-text offset1">
									请选择抽奖范围后点击抽奖
								</span>
							</div>
							<div class="row">
								<div class="control-group span9">
									<label for="" class="control-label">日期范围:<s>*</s></label>
									<div class="controls">
										<span><input type="text" name="start_date" value="{$start_date|default:""}" class="calendar js-start"> <label>至</label> <input type="text" name="end_date" value="{$end_date|default:""}" class="calendar js-end">
										</span>
									</div>
								</div>
								<div class="control-group span9">
									<label for="" class="control-label">订单金额范围:</label>
									<div class="controls">
										<span>
											<input type="text" name="start_pay" value="{$start_pay|default:""}" class="bui-select-input" > <label>至</label> <input type="text" value="{$end_pay|default:""}"  name="end_pay" class="bui-select-input">
										</span>
									</div>
								</div>
							</div>
							<div class="row">
								<div class="control-group span7">
									<label for="" class="control-label">选择订单类型:</label>
									<div class="controls">
										<select name="ordertype">
										<option value="">全部类型</option>
										{foreach from=$topics item=item key=key}
										<option value="{$key}" {if $ordertype == $key}selected{/if}>{$item}</option>
										{/foreach}
										</select>
									</div>
								</div>
							</div>
							<div class="row">
								<div class="control-group span7">
									<label for="" class="control-label">抽出数量:</label>
									<div class="controls">
										<select name="count">
										<option value="1" {if $count==1}selected{/if}>1名</option>
										<option value="10" {if $count==10}selected{/if}>10名</option>
										</select>
									</div>
								</div>
							</div>
							<div class="row">
							  <div class="form-actions offset3">
								<button type="submit" class="button button-primary">抽奖</button>
								<button type="reset" class="button">重置</button>
							  </div>
							</div>
						</div>
					</div>
				</div>
			  </form>
			</div>			
			<input type="hidden" class="type" value="{$type|default:0}" />
        <!--内容部分-->
        </div>
		{if $total==0}
			没有符合条件的订单，无法抽奖。
		{/if}
		{if $total>0}
		<div class="row">
		<table cellspacing="0" class="table table-bordered" style="border-top:none">
          <thead>
			  总共符合条件的订单有{$total}条，已抽出以下中奖订单：
		  </thead>
		  <tbody>
            <tr>
              <th width="15"></th>
              <th>买家</th>
              <th width="60">付款</th>
              <th width="30">订单号</th>
              <th width="30">时间</th>
              <th width="60">类型</th>
              <th width="60">操作</th>
            </tr>
		  {foreach key=key item=item from=$data}
            <tr class="re{$ctp}{$item.id}">
              <td><input type="checkbox" data-gid="{$item.id}" class="js-select"></td>
			  <td>
			  {$item.buyer_nick}
			  </td>
              <td>{$item.payment}</td>
			  <td><a href="http://trade.taobao.com/trade/detail/trade_item_detail.htm?bizOrderId={$item.tid}" target="_blank">{$item.tid}</a></td>
			  <td>{$item.pub_time}</td>
			  <td>
				{$item.topic}
			  </td>
			  <td><button class="button button-mini js-manfj js-{$item.tid}"  data-tid="{$item.tid}" data-nick="{$item.buyer_nick}" >设置奖品</button></td>
            </tr>
		{/foreach}
          </tbody>
        </table>
		</div>
		{/if}
</div>